package com.zc.redisson.stream.domain;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.concurrent.TimeUnit;

/**
 * 通讯告警规则对象 factory_comm_alarm_rule
 *
 * @author inspur
 * @date 2022-07-08
 */
public class FactoryCommAlarmRule
{
    private static final long serialVersionUID = 1L;

    /** $column.columnComment */
    private Long id;


    /** 设备UUID */
//    @Excel(name = "设备UUID")
    private String deviceUuid;

    private String modelName;

    private String deviceNo;

    private String deviceName;

    /** 告警类型 */
    private String  alarmType;

    /** 告警级别 */
    private Integer alarmLevel;
    private String alarmLevelName;

    /** 状态 */
    private Integer status;

    private String statusName;

    /** 规则时长 */
    private Long ruleDuration;

    /** 规则单位 */
    private Integer ruleUnit;

    private String ruleUnitName;

    private String alarmPhoneNumbers = "";

    private int smsCountLimit = 1;


    public String getAlarmLevelName() {
        return alarmLevelName;
    }

    public void setAlarmLevelName(String alarmLevelName) {
        this.alarmLevelName = alarmLevelName;
    }

    public String getStatusName() {
        return statusName;
    }

    public void setStatusName(String statusName) {
        this.statusName = statusName;
    }

    public String getRuleUnitName() {
        return ruleUnitName;
    }

    public void setRuleUnitName(String ruleUnitName) {
        this.ruleUnitName = ruleUnitName;
    }

    public void setId(Long id)
    {
        this.id = id;
    }

    public Long getId()
    {
        return id;
    }
    public void setDeviceType(String deviceType)
    {
        this.deviceType = deviceType;
    }

    public String getDeviceType()
    {
        return deviceType;
    }
    public void setModelUuid(String modelUuid)
    {
        this.modelUuid = modelUuid;
    }

    public String getModelUuid()
    {
        return modelUuid;
    }
    public void setDeviceUuid(String deviceUuid)
    {
        this.deviceUuid = deviceUuid;
    }

    public String getDeviceUuid()
    {
        return deviceUuid;
    }
    public void setAlarmType(String alarmType)
    {
        this.alarmType = alarmType;
    }

    public String getAlarmType()
    {
        return alarmType;
    }
    public void setAlarmLevel(Integer alarmLevel)
    {
        this.alarmLevel = alarmLevel;
    }

    public Integer getAlarmLevel()
    {
        return alarmLevel;
    }
    public void setStatus(Integer status)
    {
        this.status = status;
    }

    public Integer getStatus()
    {
        return status;
    }
    public void setRuleDuration(Long ruleDuration)
    {
        this.ruleDuration = ruleDuration;
    }

    public Long getRuleDuration()
    {
        return ruleDuration;
    }
    public void setRuleUnit(Integer ruleUnit)
    {
        this.ruleUnit = ruleUnit;
    }

    public Integer getRuleUnit()
    {
        return ruleUnit;
    }

    public String getAlarmPhoneNumbers() {
        return alarmPhoneNumbers;
    }

    public void setAlarmPhoneNumbers(String alarmPhoneNumbers) {
        this.alarmPhoneNumbers = alarmPhoneNumbers;
    }

    public int getSmsCountLimit() {
        return smsCountLimit;
    }

    public void setSmsCountLimit(int smsCountLimit) {
        this.smsCountLimit = smsCountLimit;
    }

    ///////////////////////////////////////////////
    //是否发送短信
    private Boolean sendMessage;
    /** 设备类型 */
    private String deviceType;
    private String deviceTypeName;
    /** 设备型号 */
//    @Excel(name = "设备型号")
    private String modelUuid;

    public String getDeviceName() {
        return deviceName;
    }

    public void setDeviceName(String deviceName) {
        this.deviceName = deviceName;
    }

    public String getModelName() {
        return modelName;
    }

    public void setModelName(String modelName) {
        this.modelName = modelName;
    }

    public String getDeviceNo() {
        return deviceNo;
    }

    public void setDeviceNo(String deviceNo) {
        this.deviceNo = deviceNo;
    }

    public Boolean getSendMessage() {
        return sendMessage;
    }

    public void setSendMessage(Boolean sendMessage) {
        this.sendMessage = sendMessage;
    }

    public String getDeviceTypeName() {
        return deviceTypeName;
    }

    public void setDeviceTypeName(String deviceTypeName) {
        this.deviceTypeName = deviceTypeName;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("deviceType", getDeviceType())
            .append("modelUuid", getModelUuid())
            .append("deviceUuid", getDeviceUuid())
            .append("alarmType", getAlarmType())
            .append("alarmLevel", getAlarmLevel())
            .append("status", getStatus())
            .append("ruleDuration", getRuleDuration())
            .append("ruleUnit", getRuleUnit())
            .toString();
    }

    public TimeUnit getRuleTimeUnit() {
        switch (ruleUnit) {
            case 1:
                return TimeUnit.SECONDS;
            case 2:
                return TimeUnit.MINUTES;
            case 3:
                return TimeUnit.HOURS;
        }
        return null;
    }

    public String getRuleTimeUnitLabel() {
        switch (ruleUnit) {
            case 1:
                return "秒";
            case 2:
                return "分";
            case 3:
                return "时";
        }
        return null;
    }
}
